import java.util.*;

public class Average3 {
    public static void main(String[] args) {
        System.out.println("请输入几个整数，让我来计算他们的平均值，输入0结束！");
            Scanner console = new Scanner(System.in);
            double sum = 0;
            int count = 0;
            while(true) {
                try {
                    int number = console.nextInt();
                    if (number == 0) {
                        break;
                    }
                    sum += number;
                    count++;
        }catch (InputMismatchException ex) {
            System.out.printf("略过非整数输入：%s%n",console.next());
        }
    }
    System.out.printf("平均：%.2f%n",sum / count);
    }
}
